import React, { Component } from 'react';
// 引入css
import './css/tips.css'
export default class Tips extends Component {
  componentDidMount () {
    let HomeAudioKong = document.getElementsByClassName('HomeAudioKong')[0];
    if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
      HomeAudioKong.style.display = 'block';
      // console.log('当前设备为苹果')
      this.props.history.replace('/')
    } else if (/(Android)/i.test(navigator.userAgent)) {
      HomeAudioKong.style.display = 'block';
      // console.log('当前设备为安卓')
      this.props.history.replace('/')
    } else if (/(Windows)/i.test(navigator.userAgent)) {
      // console.log('当前设备为电脑')
      // 隐藏悬浮音乐
      HomeAudioKong.style.display = 'none';
      // 暂停音乐
      let AudioHome = document.getElementById('AudioHome');
      AudioHome.pause();
      this.props.history.replace('/Tips')
    }
  }
  render () {
    return (
      <div className='tips'>
        <h1>本站为<span>手机端网站</span>，请使用手机浏览，或将电脑调整为手机模式并刷新网页</h1>
      </div>
    )
  }
}